function beginOfDay(date) {
  return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}

function endOfDay(date) {
  return new Date(
    date.getFullYear(),
    date.getMonth(),
    date.getDate(),
    23,
    59,
    59,
    999
  );
}
export const pickerOptionsDs = {
  //禁用今天之后的日期
  disabledDate(time) {
    return (
      time.getTime() >
      new Date(new Date().toLocaleDateString()).getTime() +
        24 * 60 * 60 * 1000 -
        1
    );
  },
  //快捷选项
  shortcuts: [
    {
      text: "最近一周",
      value() {
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
        const end = new Date();
        return [beginOfDay(start), endOfDay(end)];
      },
    },
    {
      text: "最近一个月",
      value() {
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
        const end = new Date();
        return [beginOfDay(start), endOfDay(end)];
      },
    },
    {
      text: "最近三个月",
      value() {
        const start = new Date();
        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
        const end = new Date();
        return [beginOfDay(start), endOfDay(end)];
      },
    },
  ],
};
